<template>
  <el-select
      v-model="value"
      placeholder="请选择"
      size="mini"
  >
    <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="Number(item.value)">
    </el-option>
  </el-select>
</template>

<script>
export default {
  data() {
    return {
      value: 0
    }
  },
  props: {
    options: {
      type: Array,
      default: () => {
        return [
          {
            value: 0,
            label: '全部'
          }, {
            value: 1,
            label: '黄金糕'
          }, {
            value: 2,
            label: '双皮奶'
          }, {
            value: 3,
            label: '蚵仔煎'
          }, {
            value: 4,
            label: '龙须面'
          }, {
            value: 5,
            label: '北京烤鸭'
          }]
      }
    },
    flushFlag: {
      type: Boolean,
      default: false
    },
    selectValue: {
      type: Number,
      default: 0
    }
  },
  watch: {
    value: function (val) {
      this.$emit("SelectChange", val)
    },
    /**
     * 查询条件重置
     */
    flushFlag: function () {
      this.value = this.selectValue
    },

    selectValue: function (val) {
      this.value = val
    }
  },
  created() {
    this.value = this.selectValue;
  }
}
</script>

<style scoped>

</style>